# -*- coding: utf-8 -*-
'''
@文件    :{{ file_name }}.py
@说明    :
@时间    :2025/08/28 15:30:00
@作者    :{{ author }}
@版本    :1.0
'''

from fastapi import APIRouter, Body
from app.core.routeclass import OperationLogRoute
from app.schemas.{{module_name}}.{{file_name}} import QuerySchema, CreateSchema, UpdateSchema
from app.controllers.{{module_name}}.{{file_name}} import controller


router = APIRouter(route_class=OperationLogRoute)


@router.post("/list",summary="获取列表")
async def {{file_name}}_list(
    payload: QuerySchema
):
    return await controller.get_list(payload)


@router.post("/create",summary="创建")
async def {{file_name}}_create(
    payload: CreateSchema
):
    result = await controller.create(payload)
    return result


@router.post("/update",summary="修改")
async def {{file_name}}_update(
    payload: UpdateSchema
):
    result = await controller.update(payload)
    return result


@router.post("/active",summary="禁用/激活")
async def {{file_name}}_active(
    id: int = Body(...,description="唯一Id",embed=True)
):
    result = await controller.active(id)
    return result


@router.post("/delete",summary="删除")
async def {{file_name}}_delete(
    id: int = Body(...,description="唯一Id",embed=True)
):
    result = await controller.delete(id)
    return result